Fix __gpfn_to_mfn() to work correctly when not executed
authorkaf24@firebug.cl.cam.ac.uk <kaf24@firebug.cl.cam.ac.uk>
Wed, 23 Nov 2005 12:58:44 +0000 (13:58 +0100)
committerkaf24@firebug.cl.cam.ac.uk <kaf24@firebug.cl.cam.ac.uk>
Wed, 23 Nov 2005 12:58:44 +0000 (13:58 +0100)
in the queried domain's context.

Signed-off-by: Keir Fraser <keir@xensource.com>
xen/include/asm-x86/shadow.h

index 05544a8bcd4b93cbd1712169b7501cc1bfa8d5f9..5d82713cae9aa190573dab6d52f81d11d6aab63d 100644 (file)
@@ -283,21 +283,23 @@ static inline void shadow_mode_disable(struct domain *d)
 
 /************************************************************************/
 
-#define __mfn_to_gpfn(_d, mfn)                         \
-    ( (shadow_mode_translate(_d))                      \
-      ? get_pfn_from_mfn(mfn)                                   \
+#define __mfn_to_gpfn(_d, mfn)                  \
+    ( (shadow_mode_translate(_d))               \
+      ? get_pfn_from_mfn(mfn)                   \
       : (mfn) )
 
-#define __gpfn_to_mfn(_d, gpfn)                        \
-    ({                                                 \
-        (shadow_mode_translate(_d))                    \
-        ? get_mfn_from_pfn(gpfn)                \
-        : (gpfn);                                      \
+#define __gpfn_to_mfn(_d, gpfn)                 \
+    ({                                          \
+        (shadow_mode_translate(_d))             \
+        ? (((_d) == current->domain) ?          \
+           get_mfn_from_pfn(gpfn) :             \
+           gpfn_to_mfn_foreign((_d), (gpfn)))   \
+        : (gpfn);                               \
     })
 
-#define __gpfn_to_mfn_foreign(_d, gpfn)                \
-    ( (shadow_mode_translate(_d))                      \
-      ? gpfn_to_mfn_foreign(_d, gpfn)                  \
+#define __gpfn_to_mfn_foreign(_d, gpfn)         \
+    ( (shadow_mode_translate(_d))               \
+      ? gpfn_to_mfn_foreign(_d, gpfn)           \
       : (gpfn) )
 
 extern unsigned long gpfn_to_mfn_foreign(